/*
* 折线图
*
*/

import React, { Component } from 'react';
import { Chart, Geom, Tooltip, Axis, Legend } from 'bizcharts';


export class Histogram extends Component {
	static defaultProps = {};

	constructor(props) {
		super(props);

		this.tw = null;
		this.rw = null;
		this.state = {};
	}

	componentDidMount() {}


	render() {
		const { data, scale, lineProps, unit } = this.props;

		return (
			<div style={{width: '95%', height: '100%'}}>
				<Chart autoFit padding="auto" data={data} scale={scale}>
					<Legend visible={false}/>
					<Axis name={'name'}/>
					<Axis name={'value'} label={null} grid={null}/>
					<Tooltip
						crosshairs={{ type: 'y' }}
						formatter={(params) => {
							const valueWithUnit = `${params.value} ${unit}`; // 拼接单位
							return `类别：${params.name}<br/>值：${valueWithUnit}`;
						}}
					/>
					<Geom type={'interval'} position={"name*value"} size={20} color={'name'}/>
				</Chart>
			</div>
		);
	}
}

export default Histogram;
